# -*- coding: utf-8 -*-
# @Time : 2021/9/9 15:09
# @Author : 伟哥
# @Email : xw@gmail.com
# @File : test_shangji.py
# @Project : crm
'''删除一条商机功能'''

from time import sleep
from selenium.webdriver.common.by import By
from selenium import webdriver
from utils.get_cookie import cookie
from utils import util

#定位器
shangjixuanze_locator=(By.XPATH,'//*[@id="form1"]/table/tbody/tr[2]/td[1]/input')
shanchu_locator=(By.CSS_SELECTOR,"#delete")

#前提条件

cookie=cookie(util.HOST,util.name,util.password)
driver=webdriver.Chrome()
driver.add_cookie(cookie)
driver.get('http://192.168.1.155/crm/index.php?m=business')


#测试用例步骤
try:
    #选择一条商机
    driver.find_element(*shangjixuanze_locator).click()

    #点击删除
    sleep(2)
    driver.find_element(*shanchu_locator).click()
    driver.switch_to.alert.accept()





except Exception as e:
    raise e
finally:
    sleep(5)
    driver.quit()